var webpack = require("webpack");
//生成HTML
var html = require("html-webpack-plugin")
	//删除文件
var clean = require('clean-webpack-plugin');

//sudo npm install webpack html-webpack-plugin clean-webpack-plugin style-loader css-loader less-loader less url-loader file-loader vue vue-router vue-loader vue-template-compiler babel-loader babel-preset-es2015 babel-core babel-plugin-transform-runtime 

module.exports = {
	entry: "./app/app.js",
	output: {
		path: __dirname+"/www",
		filename: "bundle.js"
	},
	module: {
		loaders: [{
				test: /\.css$/,
				loader: "style-loader!css-loader!less-loader"
			}, {
				test: /\.(png|jpe?g|gif)$/,
				loader: "url-loader?limit=5000&name=images/[name].[hash:4].[ext]"
					//点可写可不写，ext是扩展名字
			}, {
				test: /\.vue$/,
				loader: "vue-loader"
			}

		]

	},
	//自动刷新
	devServer:{
		contentBase:"./www",
		inline:true,
		port:8088
	},
	plugins: [
		new html({
			title: "首页",
			template: __dirname + "/app/index.html",
			filename: "index.html",
		}),
		new clean(["www"]),
//		new webpack.optimize.UglifyJsPlugin({
//			compress: {
//				warnings: false //取消报错提示
//			}
//		})

	],
	resolve: {
		alias: {
			vue$: 'vue/dist/vue.common.js'
		}
	}
}